<?php
require_once('BaseController.php');

/**
 * P&aacute;gina de login do sistema
 * @author Gedalias
 * @label Login
 * @name P&aacute;gina Inicial
 */
class Third_IndexController extends BaseController
{
	protected $name = 'third_index';
	protected $configFile = 'third_index';

	public function init()
	{
		parent::init();
	}

	/**
	 * Pagina de login
	 */
	public function indexAction()
	{
		//LIMPA SECAO LOGADA ANTERIORMENTE
        $this->_auth->logout();

        //FORMULARIO DE LOGIN
		$formConfig = $this->loadConfigFile( '/third_index.ini', 'form_login' );
		if( $formConfig ){
			$formLogin = new Third_Form( $formConfig );
			
			//CLASS FOR LOGIN
			$class = $formLogin->getElement('login')->getAttrib( 'class' );
			$formLogin->getElement('login')->setAttrib('class', $class.' field text full');

			//CLASS FOR PASS
			$class = $formLogin->getElement('senha')->getAttrib( 'class' );
			$formLogin->getElement('senha')->setAttrib('class', $class.' field text full');
			
			$this->view->assign('formLogin', $formLogin->render() ); 

			$this->setLayout( 'simple');
		} else{
			throw new Zend_Exception("Erro ao carregar aquivo de configura&ccedil;&atilde;o");
		}
	}
}

